import request from "./htttp2";


/**
   * 获取所有权限（菜单）
   */
 export function getAllRightNew (params) {
    return request({
      url: "/sysMenu/getAllRight.do",
      method: "get",
      params
    });
  }

  /**
  //  * 获取树形结构数据
   * @param appType 
   * @param appTypeNos 
   * @param {Object} callback
   */
export function getReadDeviceTree (params) {
  return request({
    url: "/menus/findReadDeviceTree",
    method: "get",
    params
  });
};
/**
  * 查询用户所属的单位以及下属单位树
  */
 export function getUnitTree () {
  return request({
    url: "/unit/getUnitTree.do",
    method: "post",
  });
}
// /**
/**
   * 保存单位
   * @param {String} id 单位id 不传默认添加否则更新
   * @param {String} type 类型   0企业 /1组织架构
   * @param {String} parentId 上级ID
   * @param {String} unitCode 编号
   * @param {String} name 单位名称
   * @param {String} fullName 全称
   * @param {String} address 地址
   * @param {String} leader 负责人
   * @param {String} phoneNum 联系方式
   * @param {String} memo 备注
   * @param {int} sort 排序
   * @param {int} capacity 变压器总容量
   * @param {String} inletWire 进线来源
   * @param {String} location 地理坐标
   * @param {String} joinTime 接入时间
   * @param {String} expirationTime 合同到期时间
   * @param {String} roomCount 电房数量
   * @param {String} transformerCount 变压器数量
   * @param {int} loadCapacity 负荷容量
   * @param {String} unitArea 单位面积
   * @param {String} unitPeopleNumber 单位人数 
   * @param {String} energIndex 能耗指标
   * @param {String} energySavingRatio 目标节能比例
   */
 export function saveUnit (id, type, parentId, unitCode, name, fullName, address, leader, phoneNum, memo, sort, capacity, inletWire, location, joinTime,
  expirationTime, roomCount, transformerCount, loadCapacity, unitArea, unitPeopleNumber, energIndex, energySavingRatio) {
  return request({
    url: "/unit/saveUnit.do",
    method: "post",
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Accept': '*/*'
    },
    
    params: {
      id,
      type,
      parentId,
      unitCode,
      name,
      fullName,
      address,
      leader,
      phoneNum,
      memo,
      sort,
      capacity,
      inletWire,
      location,
      joinTime,
      expirationTime,
      roomCount,
      transformerCount,
      loadCapacity,
      unitArea,
      unitPeopleNumber,
      energIndex,
      energySavingRatio,
    }
  });
}


//遥控配置
/**
   * 遥控配置->获取组分页列表信息
   */
 export function operationGroupList (params) {
  return request({
    url: "/operation/group/list",
    method: "get",
    params
  });
}
/**
   * 遥控配置->获取操作项列表
   */
 export function operationList (params) {
  return request({
    url: "/operation/operation/list",
    method: "get",
    params
  });
}
/**
   * 遥控配置->保存操作组信息
   */
 export function saveOperationListGroup (params) {
  return request({
    url: "/operation/group/save",
    method: "post",
    headers: {
      'Content-Type': 'application/json',
      'Accept': '*/*'
    },
    data: params
  });
}
/**
   * 遥控配置->删除组及关联操作项信息
   */
 export function delOperationListGroup (params) {
  return request({
    url: "/operation/group/delete",
    method: "DELETE",
    params
  });
}
/**
   *遥控配置->保存操作项信息
   */
   export function saveOperationList (params) {
    return request({
      url: "/operation/operation/save",
      method: "post",
      headers: {
        'Content-Type': 'application/json',
        'Accept': '*/*'
      },
      data: params
    });
  }
  /**
   * 遥控配置->删除操作项信息
   */
export function delOperationList (params) {
  return request({
    url: "/operation/operation/delete",
    method: "DELETE",
    params
  });
}
/**
   * 遥控配置->模糊查询分页列表信息
   */
 export function vagueOperationGroupList (params) {
  return request({
    url: "/operation/operation/vague",
    method: "get",
    params
  });
}
// /**
// 	 * 单位用户树
// 	 */
export function statementVariableTree(params) {
  return request({
      url: "/statement/variable/tree",
      method: "get",
      params
  });
}
/**
   * LOGO配置->获取所有logo信息
     
   */
export function getLogoList (params) {
  return request({
    url: "/logo/getAll",
    method: "get",
    params

  });
}

/**
* LOGO配置->获取当前logo信息
 
*/
export function getNowLogo (params) {
  return request({
    url: "/logo/getLogo",
    method: "get",
    params

  });
}


//LOGO配置->添-修改logo信息和系统名称
// /enable	是否使用：0-未使用，1-使用(添加默认为0)		
// id	主键id，添加-不传id，修改-传id		
// logoInfo	logo信息		
// systemName	系统名称
// 
export function logoSave (params) {
  return request({
    url: "/logo/save",
    method: "post",
    headers: {
      'Content-Type': 'application/json',
      'Accept': '*/*'
    },
    data: params

  });
}


export function login (params) {
  return request({
    url: "/user/login.do",
    method: "post",
    headers: {
        'Content-Type': 'multipart/form-data' // 必须手动设置
    },
    data: params
  });
}


export function getGenerallyVariableByDeviceNoLimitfn (params) {
  return request({
    url: "/channel/getGenerallyVariableByDeviceNoLimit.do",
    method: "post",
    headers: {
        'Content-Type': 'multipart/form-data' // 必须手动设置
    },
    data:params
  });
}

export function getVariableListfn (params) {
  return request({
    url: "/variable/getVariableList.do",
    method: "post",
    headers: {
        'Content-Type': 'multipart/form-data' // 必须手动设置
    },
    data:params
  });
}

export function saveAppClassType (params) {
  return request({
    url: "/virtualDevice/saveAppClassType.do",
    method: "post",
    headers: {
        'Content-Type': 'multipart/form-data' // 必须手动设置
    },
    data:params
  });
}

export function mygetUnitTree () {
  return request({
    url: "/unit/getUnitTree.do",
    method: "post",
  });
};
export function deleteAppClassType (params) {
  return request({
    url: "/virtualDevice/deleteAppClassType.do",
    method: "post",
    headers: {
        'Content-Type': 'multipart/form-data' // 必须手动设置
    },
    data:params
  });
}
/**
   * 修改虚拟设备名称
   */
 export function updateVirtualDeviceName (params) {
  return request({
    url: "/virtualDevice/updateVirtualDeviceName",
    method: "put",
    params
  });
}
export function deleteshebei (params) {
  return request({
    url: "/virtualDevice/deleteVirtualDevice.do",
    method: "post",
    headers: {
        'Content-Type': 'multipart/form-data' // 必须手动设置
    },
    data:params
  });
}

/**
   * 查询机器码
   */
 export function getMachineCodes (params) {
  return request({
    url: "/license/getMachineCode",
    method: "get",
    params
  });
}

/**
   *确实授权
   */
 export function saveVerifyAuthCode (params) {
  return request({
    url: "/license/verifyAuthCode",
    method: "get",
    params
  });
}